import datetime

from pydantic import BaseModel, Field
from typing import Optional


class ExpenseDate(BaseModel):
    # 必填
    start_time: Optional[datetime.datetime] = Field(None, comment='开始时间')
    end_time: Optional[datetime.datetime] = Field(None, comment='结束时间')


class ExpensesModel(BaseModel):
    id: Optional[int] = Field(None, title="id")
    car_type: Optional[str] = Field(None, comment='车辆型号')
    car_brand: Optional[str] = Field(None, comment='车辆牌照')
    starting_price: Optional[float] = Field(None, comment='起步价')
    miles_price: Optional[float] = Field(None, comment='里程单价')
    day_price: Optional[float] = Field(None, comment='固定整日')
    suspended_price: Optional[float] = Field(None, comment='停延费')
    create_by: Optional[str] = Field(None, comment='创建人')
    create_time: Optional[datetime.datetime] = Field(None, comment='创建时间')
    update_by: Optional[str] = Field(None, comment='修改人')
    update_time: Optional[datetime.datetime] = Field(None, comment='修改时间')


class ExpensesModelForPage(BaseModel):
    id: Optional[int] = Field(None, title="id")
    car_type: Optional[str] = Field(None, comment='车辆型号')
    car_brand: Optional[str] = Field(None, comment='车辆牌照')
    car_type_name: Optional[str] = Field(None, comment='车辆型号名称')
    starting_price: Optional[float] = Field(None, comment='起步价')
    miles_price: Optional[float] = Field(None, comment='里程单价')
    day_price: Optional[float] = Field(None, comment='固定整日')
    suspended_price: Optional[float] = Field(None, comment='停延费')
    create_by: Optional[str] = Field(None, comment='创建人')
    create_time: Optional[datetime.datetime] = Field(None, comment='创建时间')
    update_by: Optional[str] = Field(None, comment='修改人')
    update_time: Optional[datetime.datetime] = Field(None, comment='修改时间')


class ExpenseForQuery(BaseModel):
    car_type: Optional[str] = Field(None, title="车辆型号")


class ExpensePageObject(ExpenseForQuery):
    page_num: int
    page_size: int

class ExpensesModelForJisuan(BaseModel):
    # 起步价{qibu}元+固定{guding}元 +里程{licheng}元+停延费{tingyan}元= {sum}元
    starting_price_sum: Optional[float] = Field(None, comment='起步价')
    miles_price_sum: Optional[float] = Field(None, comment='里程')
    day_price_sum: Optional[float] = Field(None, comment='固定整日')
    suspended_price_sum: Optional[float] = Field(None, comment='停延费')
